#include<iostream>
#include<cstdlib>
main(int a,char**b){int m=0,c,f,j;for(a=0;a<10;a++){c=f=j=0;for(j;j<10;j++){f+=atoi(b[a*10+j+1]);c+=atoi(b[j*10+a+1]);}(f>m)?m=f:(c>m)?m=c:0;}	std::cout<<m;}
